package aimis.controller;


import aimis.domain.History;
import aimis.dto.Res;
import aimis.dto.Result;
import aimis.service.InformationServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
public class HistoryController {

    @Autowired
    InformationServiceImpl informationService;

    @PostMapping("/getHistoryAll")
    public Res getall(){
        List<History> histories = informationService.GetAllHisToryMsg();
        return Res.success(histories,"获取成功");
    }

    @PostMapping("/searchHistory")
    public Res search(String Date,String Name){
        List<History> histories = informationService.GetAllHisToryMsg();
        return Res.success(histories,"获取成功");
    }


    @PostMapping("/his/getAllSearch")
    public Res<?> getAllSearch(@RequestParam(value = "searchhis") String keyWord){
        return Res.success(informationService.getAllSearch(keyWord),"查询成功");
    }

    @DeleteMapping("/his/{id}")
    public Res delete(@PathVariable String id){
        informationService.deleteById(id);
        return Res.success();
    }

}
